<?php
/* SVN FILE: $Id$ */

/**
 * Enter description here ....
 *
 * @filesource
 * @copyright    Copyright (c) 2006, .
 * @link
 * @package
 * @subpackage
 * @since
 * @version      $Revision$
 * @modifiedby   $LastChangedBy$
 * @lastmodified $Date$
 * @license      http://www.opensource.org/licenses/mit-license.php The MIT License
 */

/**
 * Course
 *
 * Enter description here...
 *
 * @package
 * @subpackage
 * @since
 */
class Course extends AppModel
{
    var $name = 'Course';
    
    var $displayField = 'course';
    
    var $hasMany = array ('Offering' =>
    								array('className' => 'Offering'
    								),
    					  'CourseCode' =>
    								array('className' => 'CourseCode',
    								'foreignKey' => 'id'
    								),
    					  'CourseComment' =>
    								array('className' => 'CourseComment'
    								),
						  'CourseLog' =>
									array('className'=> 'CourseLog'
									)
    					);
    					
    var $belongsTo = array ('LmsType' =>
    								array('className' => 'LmsType'
    								)
    					);
    					
	var $hasAndBelongsToMany = array('Plugin' =>
                               array('className'    => 'Plugin',
                                     'joinTable'    => 'courses_plugins',
                                     'foreignKey'   => 'course_id',
                                     'associationForeignKey'=> 'plugin_id',
                                     'conditions'   => '',
                                     'order'        => '',
                                     'limit'        => '',
                                     'uniq'         => true,
                                     'finderQuery'  => '',
                                     'deleteQuery'  => '',
                               )
                               );
    					
    function delete($id) 
    {
    	if ($id)
      {
          $this->id = $id;
          $this->saveField('enrollment_active', '0');
      }
    }
}

?>